package com.westos.anno.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * 使用注解方式实现的AOP
 */
@Component
@Aspect
public class MyAspect {

    @After("execution(* com.westos.anno.UserService.removeUser(..))")
    public void dosomethingbefore(JoinPoint joinPoint){
        System.out.println("MyAspect方法执行后");
        System.out.println("方法参数："+joinPoint.getArgs());
        System.out.printf(""+joinPoint.getThis().getClass().getName());


    }

}